import sys
#
#reload(sys)
#sys.setdefaultencoding( "utf-8" )
 
import arcpy
import string
import os
 
try:
    arcpy.AddMessage('-----------start-----------')
    path=arcpy.GetParameterAsText(0)
    ver=arcpy.GetParameterAsText(1)
    for root,dirs,files in os.walk(path):
        for afile in files:
            if afile[-4:].lower() == '.mxd':
                inFile=root + os.sep + afile
                arcpy.AddMessage('inFile:'+inFile)
                mxd = arcpy.mapping.MapDocument(inFile)
                outFile=root + os.sep + afile[0:afile.rfind('.')]+'-'+ver+'.mxd'
                arcpy.AddMessage('outFile:'+outFile)
                mxd.saveACopy(outFile,ver)
    arcpy.AddMessage('-----------end-----------')
except arcpy.ExecuteError:
    print arcpy.GetMessages()